#ifndef __BUOLA_SCENE_CSKELETON_H__
#define __BUOLA_SCENE_CSKELETON_H__

#include <buola/scene.h>
#include <buola/scene/cmesh.h>
#include <buola/scene/cobject.h>

namespace buola { namespace scene {

class CSkeleton : public CObject
{
public:
    struct SAssignIndexContext
    {
        int mNextIndex;
        PMesh mMesh;
    };

    struct SSkinMeshContext
    {
        PMesh mMesh;
    };

    struct SFillMatricesContext
    {
        mat::CMat34d mModelMatrix;
        mat::CMat34d mViewMatrix;
        std::vector<mat::CMat34d> mMatrices;
    };

public:
    CSkeleton();
    ~CSkeleton();

    void Update();
    virtual void Render(CRenderContext &pContext);
    void Prepare(PMesh pMesh);

    void SetRoot(PBone pBone);
    PBone GetRoot() {   return mRoot;   }
    
    PMesh GetMesh() {   return mMesh;   }
    
private:
    PBone mRoot;
    PMesh mMesh;

    int mBoneIndexCount;
    
    CTechnique *mTechnique;
};

/*namespace scene*/ } /*namespace buola*/ }

#endif
